
$(function(){
$('#endTime').datebox({
formatter:function(date){
	return date.getYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
}
});
$('#startTime').datebox({
formatter:function(date){
	return date.getYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
}
});
$("#searchid").linkbutton({
	 text:'查询',
	 iconCls:'icon-search'
});
 $('#grid').datagrid({
    title : '您所在的位置：商家后台管理&nbsp;&nbsp;--&gt;&gt;&nbsp;&nbsp;评价管理',
    width:1000,
    height:400,
    nowrap: false,
	striped: true,
	collapsible:false,
    url:'../pingjia/pingjiaManage.shtml',
    frozenColumns:[[
	                {field:'ck',title:'选择',checkbox:true}
	                ]],
    columns:[[
			        {title:'基本信息',colspan:6},
					{field:'opt',title:'操作',width:180,align:'center', rowspan:2,
						formatter:function(value,rec){
						return '<span style="color:red"><span onclick=read("'+rec.id+'")>查看</span>&nbsp;&nbsp;&nbsp;<span onclick=reply1("'+rec.id+'")>回复</span>';
						}
					}
				],[ 
					{field:'title',title:'标题',width:300},
					{field:'createTimeStr',title:'评价时间',width:140,align:'center'},
				    {field:'username',title:'业主姓名',width:100,align:'center'},
				    {field:'type',title:'评价',width:60,align:'center',formatter:function(value){if(value=="1") return "好评";else return "差评"}},
				    {field:'pjtype',title:'来源',width:60,align:'center',formatter:function(value){if(value=="1") return "拼购";else if(value=="2") return "抢购";else return ""}},
				    {field:'reply',title:'回复状态',width:80,align:'center',formatter:function(value){if(value!=null) return "已回复";else return "未回复"}}
				]],
				pagination:true,
				rownumbers:true,
				queryParams:{
				}
				}
				
		
              
);
    	 var page = $("#grid").datagrid("getPager").pagination("options");
			page.beforePageText = '第';
		  page.afterPageText = '页,共{pages}页';

			page.displayMsg = '显示从 {from} 至 {to} / {total} 的数据';
		 $(".searchcenter").keydown(function(){
	     if(event.keyCode==13)
         {
           onSearch();
         }
	    });	
});
   

   function   onSearch(){
            var queryParams =$('#grid').datagrid("options").queryParams;
			queryParams.type=$("#type").val();
			queryParams.startTime=$("#stime").val();
			queryParams.endTime=$("#etime").val();
			queryParams.username=$("#username").val();
			queryParams.reply=$("#reply").val();
			$('#grid').datagrid("reload");
   }
     
     function read(id){
       window.location.href="../pingjia/topingjiaInfo.shtml?flag=1&id="+id;
     }
      function reply1(id){
       window.location.href="../pingjia/topingjiaInfo.shtml?flag=2&id="+id;
     }
     
     

